import java.awt.Color;
import java.io.Serializable;

/**
 * VertexAttr represents a vertex with attributes name, xpos, ypos, width, height,
 * shape, color. Objects of VertexAttr can be saved through serialization.
 *
 * @version 1.0
 * @author K.Vamsi Krishna
 */
public class VertexAttr implements Serializable
{
	/**
	 * Used for vertex shape, indicates a circle/ellipse.
	 */
	public static final int SHAPE_CIRCLE = 1;
	/**
	 * Used for vertex shape, indicates a sqaure/rectangle.
	 */
	public static final int SHAPE_RECTANGLE = 2;
	/**
	 * Used for default vertex fillcolor, indicates a light blue.
	 */
	public static final Color FILLCOLOR_DEFAULT = new Color(166,196,245);
	
	private String name;
	private int xpos;
	private int ypos;
	private int width;
	private int height;
	private int shape;
	private Color color;
	private Color fillColor;
	
	/**
	 * Creates an VertexAttr object with default values
	 * name = "", xpos = 0, ypos = 0, width = 20, height = 20,
	 * shape = VertexAttr.SHAPE_CIRCLE, color = Color.BLACK,
	 * fillColor = VertexAttr.FILLCOLOR_DEFAULT.
	 */
	public VertexAttr()
	{
		name = new String("");
		xpos = 0;
		ypos = 0;
		width = 18;
		height = 18;
		shape = SHAPE_CIRCLE;
		color = Color.BLACK;
		fillColor = VertexAttr.FILLCOLOR_DEFAULT;
	}
	
	/**
	 * Creates an VertexAttr object with specified values.
	 * @param name   A String representing name of the vertex.
	 * @param xpos   Position of the vertex in X direction.
	 * @param ypos   Position of the vertex in Y direction.
	 * @param width  Width of the vertex.
	 * @param height Height of the vertex.
	 * @param shape  Can take VertexAttr.SHAPE_CIRCLE or VertexAttr.SHAPE_RECTANGLE.
	 * @param color  Color of the vertex.
	 * @param fillColor  Color filled in the vertex.
	 */
	public VertexAttr(String name, int xpos, int ypos, int width, int height,
						int shape, Color color, Color fillColor)
	{
		this.name = new String(name);
		this.xpos = xpos;
		this.ypos = ypos;
		this.width = width;
		this.height = height;
		this.shape = shape;
		this.color = color;
		this.fillColor = fillColor;
	}
	
	/**
	 * Creates a copy of va.
	 */
	public VertexAttr(VertexAttr va)
	{
		name = new String(va.name);
		xpos = va.xpos;
		ypos = va.ypos;
		width = va.width;
		height = va.height;
		shape = va.shape;
		color = va.color;
		fillColor = va.fillColor;
	}
	
	/**
	 * Specifies new name for the vertex.
	 */
	public void setName(String name)
	{
		this.name = new String(name);
	}
	
	/**
	 * Specifies new xpos for the vertex.
	 */
	public void setXpos(int xpos)
	{
		this.xpos = xpos;
	}
	
	/**
	 * Specifies new ypos for the vertex.
	 */
	public void setYpos(int ypos)
	{
		this.ypos = ypos;
	}
	
	/**
	 * Specifies new width for the vertex.
	 */
	public void setWidth(int width)
	{
		this.width = width;
	}
	
	/**
	 * Specifies new height for the vertex.
	 */	
	public void setHeight(int height)
	{
		this.height = height;
	}
	
	/**
	 * Specifies new shape for the vertex.
	 */		
	public void setShape(int shape)
	{
		this.shape = shape;
	}
	
	/**
	 * Specifies new fill color for the vertex.
	 */
	public void setColor(Color color)
	{
		this.color = color;
	}
	
	/**
	 * Specifies new color for the vertex.
	 */
	public void setFillColor(Color fillColor)
	{
		this.fillColor = fillColor;
	}
	
	/**
	 * Returns the name of the vertex.
	 */
	public String getName()
	{
		return name;
	}
	
	/**
	 * Returns the xpos of the vertex.
	 */
	public int getXpos()
	{
		return xpos;
	}
	
	/**
	 * Returns the ypos of the vertex.
	 */	
	public int getYpos()
	{
		return ypos;
	}
	
	/**
	 * Returns the width of the vertex.
	 */
	public int getWidth()
	{
		return width;
	}
	
	/**
	 * Returns the height of the vertex.
	 */
	public int getHeight()
	{
		return height;
	}
	
	/**
	 * Returns the shape of the vertex.
	 */
	public int getShape()
	{
		return shape;
	}
	
	/**
	 * Returns the color of the vertex.
	 */
	public Color getColor()
	{
		return color;
	}
	
	/**
	 * Returns the fill color of the vertex.
	 */
	 public Color getFillColor()
	{
		return fillColor;
	}
}